// prepare "namespace"
window.bryntum         = window.bryntum || {};
window.bryntum.locales = window.bryntum.locales || {};

// put the locale under window.bryntum.locales to make sure it is discovered automatically
window.bryntum.locales.Zh = {

    localeName : 'Zh',
    localeDesc : 'Chinese',

    // Translations for common words and phrases which are used by all classes.
    Object : {
        Yes    : '是',
        No     : '否',
        Cancel : '取消'
    },

    //region Columns

    AddNewColumn : {
        'New Column' : 'New Column'
    },

    EarlyStartDateColumn : {
        'Early Start' : '最早开始'
    },

    EarlyEndDateColumn : {
        'Early End' : '最早结束'
    },

    LateStartDateColumn : {
        'Late Start' : '最晚开始'
    },

    LateEndDateColumn : {
        'Late End' : '最晚结束'
    },

    TotalSlackColumn : {
        'Total Slack' : '总时长'
    },

    CalendarColumn : {
        Calendar : '日历'
    },

    ConstraintDateColumn : {
        'Constraint Date' : '约束日期'
    },

    ConstraintTypeColumn : {
        'Constraint Type' : '约束类型'
    },

    DependencyColumn : {
        'Invalid dependency found, change is reverted' : '无效的依赖项，请改正'
    },

    DurationColumn : {
        Duration : '持续项'
    },

    EffortColumn : {
        Effort : '估计工作量'
    },

    EndDateColumn : {
        Finish : '完成时间'
    },

    EventModeColumn : {
        'Event mode' : 'Event mode',
        'Manual'     : 'Manuell',
        'Auto'       : 'Auto'
    },

    ManuallyScheduledColumn : {
        'Manually scheduled' : '管理进度'
    },

    MilestoneColumn : {
        'Milestone' : 'Meilenstein'
    },

    NameColumn : {
        Name : '名称'
    },

    NoteColumn : {
        Note : '节点'
    },

    PercentDoneColumn : {
        '% Done' : '完成%'
    },

    PredecessorColumn : {
        Predecessors : '前任'
    },

    ResourceAssignmentColumn : {
        'Assigned Resources' : '分配资源'
    },

    ResourceInfoColumn : {
        eventCountText : function(data) {
            return data + ' Veranstaltung' + (data !== 1 ? 'en' : '');
        }
    },

    SchedulingModeColumn : {
        'Scheduling Mode' : '进度模式'
    },

    ShowInTimelineColumn : {
        'Show in timeline' : '显示时间线'
    },

    SequenceColumn : {
        Sequence : '#'
    },

    StartDateColumn : {
        Start : '启动时间'
    },

    SuccessorColumn : {
        Successors : '继承'
    },

    WBSColumn : {
        WBS : 'WBS'
    },

    //endregion

    //region Gantt

    ProjectLines : {
        'Project Start' : '项目启动',
        'Project End'   : '项目结束'
    },

    TaskTooltip : {
        Start    : '启动日期',
        End      : '结束日期',
        Duration : '持续',
        Complete : '完成'
    },

    AssignmentGrid : {
        Name     : '资源名称',
        Units    : '单元',
        '%'      : '%',
        unitsTpl : function(value) {
            return value.value ? value.value + '%' : '';
        }
    },

    AssignmentPicker : {
        'Save'   : '保存',
        'Cancel' : '取消'
    },

    AssignmentEditGrid : {
        Name  : '资源名称',
        Units : '部件'
    },

    ConstraintTypePicker : {
        'Finish no earlier than' : 'Finish no earlier than',
        'Finish no later than'   : 'Finish no later than',
        'Must start on'          : 'Must start on',
        'Must finish on'         : 'Must finish on',
        'Start no earlier than'  : 'Start no earlier than',
        'Start no later than'    : 'Start no later than'
    },

    Gantt : {
        'Add'          : '新增',
        'New Task'     : '新增任务',
        'Edit': '编辑',
        'Indent': '缩进',
        'Outdent': '突出',
        'Task above'   : '在任务上',
        'Task below'   : '在任务下',
        'Delete task'  : '删除任务',
        'Milestone'      : '里程碑',
        'Sub-task'     : '子任务',
        'Successor'      : '继承',
        'Predecessor'    : '上任',
        changeRejected : 'Scheduling engine rejected the changes'
    },

    GanttCommon : {},

    SchedulerProCommon : {
        SS              : 'AA',
        SF              : 'EA',
        FS              : 'AE',
        FF              : 'EE',
        StartToStart    : 'Anfang-Anfang',
        StartToEnd      : 'Anfang-Ende',
        EndToStart      : 'Enge-Anfang',
        EndToEnd        : 'Enge-Ende',
        dependencyTypes : [
            'AA',
            'EA',
            'AE',
            'EE'
        ],
        dependencyTypesLong : ["Start-to-Start", "Start-to-End", "End-to-Start", "End-to-End"]
    },

    ProTaskEdit : {
        "Edit event": "编辑事件"
    },

    TaskEditorBase : {
        'editorWidth' : '50em',
        'Information' : '信息',
        'Save'        : '保存',
        'Cancel'      : '取消',
        'Delete'      : '删除'
    },

    SchedulerGeneralTab : {
        labelWidth           : '15em',
        'General'            : '通用配置',
        'Name'               : '名称',
        '% complete'         : '完成度%',
        'Duration'           : '持续',
        'Start'              : '开始时间',
        'Finish'             : '完成时间',
        'Effort'             : '估计工作量',
        'Dates'              : '日期',
        'Manually scheduled' : '定期管理',
        'Calendar'           : '日历'
    },

    GeneralTab : {
        labelWidth   : '15em',
        'General'    : '通用配置',
        'Name'       : '名称',
        '% complete' : '完成度%',
        'Duration'   : '持续',
        'Start'      : '开始时间',
        'Finish'     : '完成时间',
        'Effort'     : '估计工作量',
        'Dates'      : '日期'
    },

    AdvancedTab : {
        labelWidth           : '15em',
        'Advanced'           : '高级',
        'Calendar'           : '日历',
        'Scheduling mode'    : '调度算法模式',
        'Effort driven'      : '尽力驱动',
        'Manually scheduled' : '进度管理',
        'Constraint type'    : '限定类型',
        'Constraint date'    : '限定日期',
        'Constraint'         : '约束条件'
    },

    DependencyTab : {
        'Predecessors'                        : '前任',
        'Successors'                          : '继承',
        'ID'                                  : 'ID',
        'Name'                                : '名称',
        'Type'                                : '类型',
        'Lag'                                 : '延迟',
        'Cyclic dependency has been detected' : '检测出循环依赖！'
    },

    ResourcesTab : {
        'Resources' : '资源集',
        'Resource'  : '资源',
        'Units'     : '单元',
        unitsTpl    : function(value) {
            return value.value ? value.value + '%' : '';
        }
    },

    NotesTab : {
        'Notes' : '注释'
    },

    SchedulingModePicker : {
        'Normal'         : '正常',
        'Fixed Duration' : '固定持续',
        'Fixed Units'    : '固定单元',
        'Fixed Effort'   : '固定工作量'
    },

    //endregion

    //region Columns

    TemplateColumn : {
        noTemplate: "TemplateColumn needs a template",
        noFunction: "TemplateColumn.template must be a function"
    },

    ColumnStore : {
        columnTypeNotFound: function(e) {
            return "Column type '".concat(e.type, "' not registered")
        }
    },

    //endregion

    //region Mixins

    InstancePlugin : {
        fnMissing: function(e) {
            return "Trying to chain fn ".concat(e.plugIntoName, "#").concat(e.fnName, ", but plugin fn ").concat(e.pluginName, "#").concat(e.fnName, " does not exist")
        },
        overrideFnMissing: function(e) {
            return "Trying to override fn ".concat(e.plugIntoName, "#").concat(e.fnName, ", but plugin fn ").concat(e.pluginName, "#").concat(e.fnName, " does not exist")
        }
    },

    //endregion

    //region Features

    ColumnPicker : {
        columnsMenu: "Columns",
        hideColumn: "Hide column",
        hideColumnShort: "Hide"
    },

    Filter : {
        applyFilter: "应用过滤",
        filter: "过滤",
        editFilter: "编辑过滤",
        on: "打开",
        before: "Before",
        after: "After",
        equals: "对等过滤",
        lessThan: "Less than",
        moreThan: "More than",
        removeFilter: "移除过滤"
    },

    FilterBar : {
        enableFilterBar: "Show filter bar",
        disableFilterBar: "Hide filter bar"
    },

    Group : {
        groupAscending: "Group ascending",
        groupDescending: "Group descending",
        groupAscendingShort: "Ascending",
        groupDescendingShort: "Descending",
        stopGrouping: "Stop grouping",
        stopGroupingShort: "Stop"
    },

    Search : {
        searchForValue : '输入搜索内容'
    },

    Sort : {
        sortAscending: "Sort ascending",
        sortDescending: "Sort descending",
        multiSort: "Multi sort",
        removeSorter: "Remove sorter",
        addSortAscending: "Add ascending sorter",
        addSortDescending: "Add descending sorter",
        toggleSortAscending: "Change to ascending",
        toggleSortDescending: "Change to descending",
        sortAscendingShort: "Ascending",
        sortDescendingShort: "Descending",
        removeSorterShort: "Remove",
        addSortAscendingShort: "+ Ascending",
        addSortDescendingShort: "+ Descending"
    },

    Tree : {
        noTreeColumn: "To use the tree feature one column must be configured with tree: true"
    },

    //endregion

    //region Grid

    Grid : {
        featureNotFound: function(e) {
            return "Feature '".concat(e, "' not available, make sure you have imported it")
        },
        invalidFeatureNameFormat: function(e) {
            return "Invalid feature name '".concat(e, "', must start with a lowercase letter")
        },
        removeRow: "删除这一项",
        removeRows: "删除这一项",
        loadFailedMessage: "数据加载失败",
        moveColumnLeft: "Move to left section",
        moveColumnRight: "Move to right section"
    },

    GridBase : {
        loadMask : '加载中...',
        noRows   : '没有读取到显示内容'
    },
    
    //region Export
    
    PdfExport : {
        "Waiting for response from server...": "Waiting for response from server..."
    },
    
    ExportDialog : {
        width: "40em",
        labelWidth: "12em",
        exportSettings: "Export settings",
        export: "Export",
        exporterType: "Control pagination",
        cancel: "Cancel",
        fileFormat: "File format",
        rows: "Rows",
        alignRows: "Align rows",
        columns: "Columns",
        paperFormat: "Paper format",
        orientation: "Orientation"
    },
    
    ExportRowsCombo : {
        all: "All rows",
        visible: "Visible rows"
    },
    
    ExportOrientationCombo : {
        portrait: "Portrait",
        landscape: "Landscape"
    },
    
    SinglePageExporter : {
        singlepage: "Single page"
    },
    
    MultiPageExporter : {
        multipage: "Multiple pages",
        exportingPage: function(e) {
            var t = e.currentPage,
            n = e.totalPages;
            return "Exporting the page ".concat(t, "/").concat(n)
        }
    },
    
    //endregion

    //endregion

    //region Widgets

    DateField : {
        invalidDate: "无效的日期输入"
    },

    Field : {
        invalidValue: "Invalid field value",
        minimumValueViolation: "Minimum value violation",
        maximumValueViolation: "Maximum value violation",
        fieldRequired: "This field is required",
        validateFilter: "Value must be selected from the list"
    },

    List : {
        loading : '加载中...'
    },

    PagingToolbar : {
        firstPage : '跳转到初始化页面',
        prevPage  : '跳转到之前的页面',
        page      : '页面',
        nextPage  : '下一页',
        lastPage  : '最后一页',
        reload    : '重新加载',
        noRecords : '没有读取到显示内容',
        pageCountTemplate(store) {
            return `von ${store.lastPage}`;
        },
        summaryTemplate(store) {
            const start = (store.currentPage - 1) * store.pageSize + 1;

            return `Ergebnisse ${start} - ${start + store.pageSize - 1} von ${store.allCount}`;
        }
    },

    TimeField : {
        invalidTime : '无效的时间输入'
    },

    //endregion

    //region Dates

    DateHelper : {
        locale       : 'zh',
        shortWeek    : 'W',
        shortQuarter : 'q',
        week         : 'Woche',
        weekStartDay : 0,
        unitNames    : [
            { single : 'millisecond', plural : 'ms', abbrev : 'ms' },
            { single : 'second', plural : 'seconds', abbrev : 's' },
            { single : 'minute', plural : '分钟', abbrev : 'min' },
            { single : 'hour', plural : '小时', abbrev : 'H' },
            { single : 'day', plural : '天', abbrev : 'd' },
            { single : 'week', plural : '周', abbrev : 'w' },
            { single : 'month', plural : '月', abbrev : 'mon' },
            { single : 'quarter', plural : '季度', abbrev : 'q' },
            { single : 'year', plural : '年', abbrev : 'yr' }
        ],
        // Used to build a RegExp for parsing time units.
        // The full names from above are added into the generated Regexp.
        // So you may type "2 w" or "2 wk" or "2 week" or "2 weeks" into a DurationField.
        // When generating its display value though, it uses the full localized names above.
        unitAbbreviations : [
            ['mil'],
            ['s', 'sec'],
            ['m', 'min'],
            ['h', 'hr'],
            ['d'],
            ['w', 'wk'],
            ['mo', 'mon', 'mnt'],
            ['q', 'quar', 'qrt'],
            ['y', 'yr']
        ],
        parsers : {
            'L'  : 'YYYY-MM-DD',
            'LT' : 'HH:mm'
        },
        ordinalSuffix : function(number) {
            return number;
        }
    },

    //endregion

    //region Scheduler

    SchedulerCommon : {
        // SS              : 'AA',
        // SF              : 'EA',
        // FS              : 'AE',
        // FF              : 'EE',
        // StartToStart    : 'Anfang-Anfang',
        // StartToEnd      : 'Anfang-Ende',
        // EndToStart      : 'Enge-Anfang',
        // EndToEnd        : 'Enge-Ende',
        // dependencyTypes : [
        //     'AA',
        //     'EA',
        //     'AE',
        //     'EE'
        // ],
        // dependencyTypesLong : [
        //     'Anfang-Anfang',
        //     'Anfang-Ende',
        //     'Enge-Anfang',
        //     'Enge-Ende'
        // ]
    },

    ExcelExporter : {
        "No resource assigned": "No resource assigned"
    },

    Dependencies : {
        from: "From",
        to: "To",
        valid: "Valid",
        invalid: "Invalid",
        Checking: "Checking…"
    },

    DependencyEdit : {
        From: "From",
        To: "To",
        Type: "Type",
        Lag: "Lag",
        "Edit dependency": "Edit dependency",
        Save: "Save",
        Delete: "Delete",
        Cancel: "Cancel",
        StartToStart: "Start to Start",
        StartToEnd: "Start to End",
        EndToStart: "End to Start",
        EndToEnd: "End to End"
    },

    EventEdit : {
        Name: "Name",
        Resource: "Resource",
        Start: "Start",
        End: "End",
        Save: "Save",
        Delete: "Delete",
        Cancel: "Cancel",
        "Edit Event": "Edit event",
        Repeat: "Repeat"
    },

    Scheduler : {
        "Add event": "Add event",
        "Delete event": "Delete event",
        "Unassign event": "Unassign event"
    },

    HeaderContextMenu : {
        pickZoomLevel: "Zoom",
        activeDateRange: "Date range",
        startText: "Start date",
        endText: "End date",
        todayText: "Today"
    },

    EventFilter : {
        filterEvents: "Filter tasks",
        byName: "By name"
    },

    TimeRanges : {
        showCurrentTimeLine: "Show current timeline"
    },

    PresetManager : {
        minuteAndHour : {
            topDateFormat : 'ddd DD.MM, HH:mm'
        },
        hourAndDay : {
            topDateFormat : 'ddd DD.MM'
        },
        weekAndDay : {
            displayDateFormat : 'HH:mm'
        }
    },

    RecurrenceConfirmationPopup : {
        "delete-title": "You’re deleting an event",
         "delete-all-message": "Do you want to delete all occurrences of this event?",
         "delete-further-message": "Do you want to delete this and all future occurrences of this event, or only the selected occurrence?",
         "delete-further-btn-text": "Delete All Future Events",
         "delete-only-this-btn-text": "Delete Only This Event",
         "update-title": "You’re changing a repeating event",
         "update-all-message": "Do you want to change all occurrences of this event?",
         "update-further-message": "Do you want to change only this occurrence of the event, or this and all future occurrences?",
         "update-further-btn-text": "All Future Events",
         "update-only-this-btn-text": "Only This Event",
         Yes: "Yes",
         Cancel: "Cancel",
         width: 600
    },

    RecurrenceLegend : {
        " and ": " and ",
        Daily: "Daily",
        "Weekly on {1}": function(e) {
            var t = e.days;
            return "Weekly on ".concat(t)
        },
        "Monthly on {1}": function(e) {
            var t = e.days;
            return "Monthly on ".concat(t)
        },
        "Yearly on {1} of {2}": function(e) {
            var t = e.days,
            n = e.months;
            return "Yearly on ".concat(t, " of ").concat(n)
        },
        "Every {0} days": function(e) {
            var t = e.interval;
            return "Every ".concat(t, " days")
        },
        "Every {0} weeks on {1}": function(e) {
            var t = e.interval,
            n = e.days;
            return "Every ".concat(t, " weeks on ").concat(n)
        },
        "Every {0} months on {1}": function(e) {
            var t = e.interval,
            n = e.days;
            return "Every ".concat(t, " months on ").concat(n)
        },
        "Every {0} years on {1} of {2}": function(e) {
            var t = e.interval,
            n = e.days,
            o = e.months;
            return "Every ".concat(t, " years on ").concat(n, " of ").concat(o)
        },
        position1: "the first",
        position2: "the second",
        position3: "the third",
        position4: "the fourth",
        position5: "the fifth",
        "position-1": "the last",
        day: "天",
        weekday: "工作日",
        "weekend day": "周末日",
        daysFormat: function(e) {
            var t = e.position,
            n = e.days;
            return "".concat(t, " ").concat(n)
        }
    },

    RecurrenceEditor : {
        "Repeat event": "Repeat event",
        Cancel: "Cancel",
        Save: "Save",
        Frequency: "Frequency",
        Every: "Every",
        DAILYintervalUnit: "天(s)",
        WEEKLYintervalUnit: "周(s) on:",
        MONTHLYintervalUnit: "月(s)",
        YEARLYintervalUnit: "年(s) in:",
        Each: "Each",
        "On the": "On the",
        "End repeat": "End repeat",
        "time(s)": "time(s)"
    },

    RecurrenceDaysCombo : {
        day: "天",
        weekday: "工作日",
        "weekend day": "周末日"
    },

    RecurrencePositionsCombo : {
        position1: "first",
        position2: "second",
        position3: "third",
        position4: "fourth",
        position5: "fifth",
        "position-1": "last"
    },

    RecurrenceStopConditionCombo : {
        Never: "Never",
        After: "After",
        "On date": "On date"
    },

    RecurrenceFrequencyCombo : {
        Daily: "Daily",
        Weekly: "Weekly",
        Monthly: "Monthly",
        Yearly: "Yearly"
    },

    RecurrenceCombo : {
        None: "None",
        "Custom...": "Custom..."
    },
    
    //region Export
    
    ScheduleRangeCombo : {
        completeview: "Complete schedule",
         currentview: "Visible schedule",
         daterange: "Date range",
         completedata: "Complete schedule (for all events)"
    },
    
    SchedulerExportDialog : {
        "Schedule range": "Schedule range",
         "Export from": "From",
         "Export to": "To"
    },
    
    //endregion

    //endregion

    //region Examples

    Column : {
        'Name'            : 'Name',
        'Age'             : 'Age',
        'City'            : 'City',
        'Food'            : 'Food',
        'Color'           : 'Color',
        'First name'      : 'First name',
        'Surname'         : 'Surname',
        'Team'            : 'Team',
        'Score'           : 'Score',
        'Rank'            : 'Rank',
        'Percent'         : 'Percent',
        'Birthplace'      : 'Birthplace',
        'Start'           : 'Start',
        'Finish'          : 'Finish',
        'Template'        : 'template',
        'Date'            : 'Date',
        'Check'           : 'Check',
        'Contact'         : 'Contact',
        'Favorites'       : 'Favorites',
        'Customer#'       : 'Customer#',
        'When'            : 'When',
        'Brand'           : 'Brand',
        'Model'           : 'Model',
        'Personal best'   : 'Personal best',
        'Current rank'    : 'Current rank',
        'Hometown'        : 'Hometown',
        'Satisfaction'    : 'Satisfaction',
        'Favorite color'  : 'Favorite color',
        'Rating'          : 'Rating',
        'Cooks'           : 'Cooks',
        'Birthday'        : 'Birthday',
        'Staff'           : 'Staff',
        'Machines'        : 'Machines',
        'Type'            : 'Type',
        'Task color'      : 'Task color',
        'Employment type' : 'Employment type',
        'Capacity'        : 'Capacity',
        'Production line' : 'Production line',
        'Company'         : 'Company',
        'End'             : 'End'
    },

    Shared : {
        'Locale changed' : 'Locale changed'
    }

    //endregion

};
